<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../../lib/layui/css/layui.css">
    <title>办结详情页</title>
</head>

<style>
    .tdAdapt {
        font-size: 16.0pt;
        word-wrap: break-word;
        word-break: break-all;
    }

    .textarea {
        margin-right: 3px;
    }

    .divarea {
        margin-bottom: 5px;
    }
    .tub{
        font-size: 16px;
        margin-right:7px;
    }

</style>

<body>
<div class="ok-body">
    <div class="layui-row " style="background-color:#ededed">
        <div>
            <div class="layui-row">
                <div style="background-color:#f8f8f8">
                    <hr class="layui-bg-gray">
                    <fieldset class="layui-elem-field">
                        <legend>警情详情 <span class="layui-badge layui-bg-cyan">已办结</span></legend>
                        <div class="layui-field-box " style="margin-left: 20px;">
                            <div class="layui-row">
                                <div class="layui-col-md9">
                                    <div class="divarea">
                                        <i class="tub layui-icon layui-icon-username" style="color: #1E9FFF;"></i>
                                        <label>分派者 : </label>
                                        <span id="askFullName"></span>
                                    </div>
                                    <div class="divarea">
                                        <i class="tub layui-icon layui-icon-home" style="color: #FF5722;"></i>
                                        <label>分派单位 : </label>
                                        <span id="askForDepartmentName"></span>
                                    </div>
                                    <div class="divarea">
                                        <i class="tub layui-icon layui-icon-log" style="color: #FFB800;"></i>
                                        <label>分派时间 : </label>
                                        <span id="askForTime"></span>
                                    </div>
                                    <div class="divarea">
                                        <i class="tub layui-icon layui-icon-username" style="color: #1E9FFF;"></i>
                                        <label>办结人 : </label>
                                        <span id="fullName"></span>(<span id="departmentName"></span>)

                                    </div>

                                </div>
                            </div>
                        </div>
                    </fieldset>
                </div>

                <div style="z-index: 9999; position: fixed ! important; right:50px; top: 80px;">
                    <button type="button" class="layui-btn layui-btn-danger" lay-submit lay-filter="deleteCase"
                            id="deleteCase">删除该警情
                    </button>
                </div>

            </div>
            <div>
                <div style="background-color:#eeebeb;">
                    <div style="width: 60%;height: 100%;margin: 0 auto;">
                        <div class="layui-collapse" lay-filter="caseData">
                            <div class="layui-colla-item">
                                <h2 class="layui-colla-title" style="font-size: 16px"><span
                                        id="caseDataChange">隐藏</span>警情信息</h2>
                                <div class="layui-colla-content layui-show" style="background-color:#fdfdfd;">
                                    <div style="background-color:#fdfdfd;padding: 50px 30px 100px 30px;">
                                        <iframe scrolling="no" frameborder="0" src="../caseCommonData/caseData.html" width="100%"
                                                height="700px" id="caseData"
                                                onload="this.height=0;var fdh=(this.Document?this.Document.body.scrollHeight:this.contentDocument.body.offsetHeight);this.height=(fdh>700?fdh:700);"></iframe>

                                    </div>
                                </div>
                            </div>
                        </div>

                        <div style="background-color:#fdfdfd;margin-top: 10px;padding-top: 20px;">
                            <iframe scrolling="no" frameborder="0" src="../caseCommonData/processData.html" width="100%"
                                    height="700px" id="processData"
                                    onload="this.height=0;var fdh=(this.Document?this.Document.body.scrollHeight:this.contentDocument.body.offsetHeight);this.height=(fdh>700?fdh:700)"></iframe>

                        </div>
                    </div>

                </div>

            </div>
        </div>
    </div>
</div>
<br/>
</body>

<script src="../../lib/layui/layui.js"></script>
<script type="text/javascript" src="../../js/jquery-3.3.1.js"></script>
<script src="../../js/application.js"></script>
<script src="../../js/model.js"></script>
<script>
    let processDataHeight=0
    let caseId = GetQueryString("caseId");
    let processId = GetQueryString("processId");
    let fullName = GetQueryString("fullName");
    let departmentName=GetQueryString("departmentName");
    getCaseData(caseId)
    getprocessData(processId)
    //获取警情详细信息页
    function getCaseData(caseId) {
        $("#caseData").on("load", function () {
            var data = {caseId: caseId}
            this.contentWindow.getParentData(data)
        })
    }
    //获取处理过程页
    function getprocessData(processId) {
        $("#processData").on("load", function () {
            var data = {processId: processId}
            this.contentWindow.getParentData(data)
        })
    }


    layui.use(['layedit', 'upload','element'], function () {
        var layedit = layui.layedit;
        var upload = layui.upload;
        var element = layui.element;

        //获取分派信息
        $.ajax({
            url: mainUri + '/caseProcInfo/selectCaseProcInfo',
            data: {
                'parentId':0,
                'processId':processId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $("#askFullName").html(data.data.askFullName);//分派者
                    $("#askForDepartmentName").html(data.data.askForDepartmentName);//分派单位
                    $("#askForTime").html(data.data.askForTime);//分派时间

                    $("#fullName").html(fullName);//办结人
                    $("#departmentName").html(departmentName);//办结部门
                }
            },
            error: function () {
                alert("服务器错误");
            }
        });

        //点击删除警情
        $("#deleteCase").on('click', deleteCase);
        function deleteCase(){
            layer.confirm('确定删除该警情吗?', {icon: 3, title: '提示'}, function (index) {
                showloading(true);
                $.ajax({
                    url: mainUri + "/case/deleteByCaseId",
                    data: {
                        "caseId": caseId
                    },
                    type: "post",
                    dataType: "json",
                    success: function (data) {
                        showloading(false)
                        if (data.code == 0) {
                            layer.msg("操作成功", {
                                icon: 1, time: 1500, end: function () {
                                    window.opener.location.href = window.opener.location.href;
                                    window.close();
                                }
                            })
                        }
                    },
                    error: function () {
                        showloading(false)
                        alert("服务器错误");
                    }
                });
            });
        }


        //详细警情页的显示隐藏
        element.on('collapse(caseData)', function(data){
            if(processDataHeight==0){
                processDataHeight=$("#processData").height();
            }
            if(!data.show){
                if(processDataHeight<800){
                    $("#processData").height(800)
                }
                $("#caseDataChange").html("显示")
            }else{
                $("#processData").height(processDataHeight)
                $("#caseDataChange").html("隐藏")
            }
        });
    });

    function caseReturnData(returnData) {

    }

    function processReturnData(returnData) {
        $("#processData").height(returnData.height)
        processDataHeight = returnData.height
    }
     //文件下载详细页
    function showProcessContent(clickId) {
        layui.use(['element','layer','okLayer'], function () {
            let okLayer = layui.okLayer;
            okLayer.open("查询条件", "../caseCommonData/fileData.html?processId=" + clickId, "35%", "50%", function (layero) {
                let iframeWin = window[layero.find("iframe")[0]["name"]];
            }, function () {

            })
        })
    }
</script>

</html>